package com.sunny;

import java.util.concurrent.Executors;

public class JoinTest implements Runnable{
    @Override
    public void run() {
        System.out.println("开始");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("结束");
    }

    public static void main(String[] args) {

        Thread thread = new Thread(new JoinTest());
        thread.start();
        try {
            thread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("主函数执行完毕");

    }
}
